<script>
    let p1 = new Promise((resolve, reject) => {
        setTimeout(() => {
            alert('加载超时')
            resolve()
        }, 1000)
        // reject('fail')
    })
    //doc.houdunren.com
    let p2 = new Promise((resolve, reject) => {
        setTimeout(() => {
            resolve('用户列表')
        }, 2000)
    })

    Promise.race([p1, p2])
        .then(result => {
            console.log(result)
        })
        .catch(error => {
            alert('加载失败')
        })
</script>
